import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {MyComponent} from '../components/my/my.component';
import {AboutComponent} from '../components/about/about.component';

/*当用户访问特定的地址时，有不同的组件*/
const routes: Routes = [
  /*加入地址后面为空 默认跳转地址*/
 /* {path: '', redirectTo: 'home', pathMatch: 'full'},*/
  { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
  {path: 'main', redirectTo: '', pathMatch: 'full'},
  {path: 'home', component: MyComponent},
  {path: 'about', component: AboutComponent}
];

/*我们声明一个新的AppRoutingModule 向Angular默认的路由中添加自定义的路由，暴露给外界*/
@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
/*创建路由模块 用来访问不同的项目路径*/
export class AppRoutingModule {

}
